package com.bnlr.lrparking.appui.sharevalue.deposit;

import android.content.Intent;
import android.os.Bundle;
import android.widget.ImageView;
import android.widget.TextView;
import com.bnlr.lrparking.R;
import com.bnlr.lrparking.base.BaseActivity;
import com.bnlr.lrparking.model.DepositListM;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by hp on 2017/8/31.
 */

public class DepositdetailsActivity extends BaseActivity {


    @BindView(R.id.tv_nav_title)
    TextView tv_nav_title;
    @BindView(R.id.deposit_detail_money)
    TextView tv_price;
    @BindView(R.id.deposit_detail_time)
    TextView tv_time;
    @BindView(R.id.tv_money)
    TextView money;
    @BindView(R.id.text_riqi)
    TextView tvRiqi;
    DepositListM.DataBean dataBean;
    private Unbinder unbinder;
    private String type = "0";
    private ImageView image_withdrawals;
    private TextView tv_auditTime,tv_tixian_type;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_depositdetails);
        unbinder = ButterKnife.bind(this);
        Intent intent = getIntent();
        dataBean = (DepositListM.DataBean) intent.getSerializableExtra("ti_detail");
        initView();
    }

    private void initView(){
        tv_nav_title.setText("提现详情");
        image_withdrawals=(ImageView)findViewById(R.id.image_withdrawals);
        tv_auditTime=(TextView)findViewById(R.id.tv_auditTime);
        tv_tixian_type=(TextView)findViewById(R.id.tv_tixian_type);
        if (dataBean != null) {
            tv_price.setText("" + dataBean.getIncomeValue());
            tv_time.setText(dataBean.getCreateTime());
            type=dataBean.getStatus();
            money.setText(dataBean.getMoney());

        }
        if (type.equals("0")){
            image_withdrawals.setImageResource(R.mipmap.withdrawals_progressbar1);
            tv_auditTime.setText("预计三个工作日内到账");
            tv_tixian_type.setText("到账时间");
            tvRiqi.setText(dataBean.getCreateTime());
            tv_tixian_type.setTextColor(getResources().getColor(R.color.main_color));
        }else if (type.equals("1")){
            image_withdrawals.setImageResource(R.mipmap.withdrawals_progressbar2);
            tv_auditTime.setText(dataBean.getAuditTime());
            tvRiqi.setText(dataBean.getCreateTime());
            tv_tixian_type.setText("提现完成");
            tv_tixian_type.setTextColor(getResources().getColor(R.color.main_color));
        }else if (type.equals("2")){
            tvRiqi.setText(dataBean.getCreateTime());
            image_withdrawals.setImageResource(R.mipmap.withdrawals_progressbar3);
            tv_auditTime.setText("原因："+dataBean.getRejectReason());
            tv_tixian_type.setText("提现失败");
            tv_tixian_type.setTextColor(getResources().getColor(R.color.order_type));
        }

    }
    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
    }
}
